package com.alfred.springboot.elasticjob.job;

import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class TestJob implements SimpleJob {
    @Override
    public void execute(ShardingContext context) {
//        log.info("============execute===========");
//        log.info(context.toString());
        switch (context.getShardingItem()) {
            case 0:
                log.info("============0===========");
                log.info(context.toString());
                break;
            case 1:
                log.info("============1===========");
                log.info(context.toString());
                break;
            case 2:
                log.info("============2===========");
                log.info(context.toString());
                break;
            default:
                log.error("============{}===========",context.getShardingItem());
                break;
        }
    }
}
